<template>
  <el-container>
    <el-header height="80px">
      <div class="header">
        <div class="header-left">
          <span class="el-icon-s-shop" style="margin-right:10px"></span>
          <span>拉勾后台管理系统</span>
        </div>
        <div class="header-right">
          <i class="el-icon-chat-line-round"></i>
          <i class="el-icon-setting"></i>
          <span>admin</span>
          <el-avatar icon="el-icon-user-solid"></el-avatar>
        </div>
      </div>
    </el-header>
    <el-container>
      <el-aside :width="`${isWidth}px`">
        <span class="fold-btn-open" :class="foldIcon" @click="changeWidth"></span>
        <el-menu
          :default-active="defaultPath"
          class="el-menu-vertical-demo"
          :collapse="isCollapse"
          router>
          <el-menu-item index="/home">
            <i class="el-icon-menu"></i>
            <span slot="title">控制台</span>
          </el-menu-item>
          <el-menu-item index="/company">
            <i class="el-icon-menu"></i>
            <span slot="title">公司管理</span>
          </el-menu-item>
          <el-menu-item index="/job">
            <i class="el-icon-menu"></i>
            <span slot="title">职位管理</span>
          </el-menu-item>
          <el-menu-item index="/recruit">
            <i class="el-icon-menu"></i>
            <span slot="title">招聘信息</span>
          </el-menu-item>
          <el-menu-item index="/notice">
            <i class="el-icon-menu"></i>
            <span slot="title">全站公告</span>
          </el-menu-item>
          <el-menu-item index="/message">
            <i class="el-icon-menu"></i>
            <span slot="title">反馈信息</span>
          </el-menu-item>
        </el-menu>
      </el-aside>
      <el-main>
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
export default {
  data() {
    return {
      isCollapse: false,
      isWidth: 201,
      foldIcon: 'el-icon-s-fold',
      defaultPath: location.pathname
    };
  },
  methods: {
    changeWidth(){
      this.isCollapse = !this.isCollapse
      this.foldIcon = this.isCollapse ? 'el-icon-s-unfold' : 'el-icon-s-fold'
      this.isWidth = this.isCollapse ? 66 : 201
    },
  }
}
</script>

<style>
.el-container{
  height: 100%;
}
.el-header{
  background-color: rgb(23, 199, 199);
  color: #fff;
}
.el-aside{
  transition: all 0.5s;
  color: skyblue;
}
.header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
}
.header-left:first-child{
  line-height: 80px;
  font-size: 20px;
  font-weight: bold;
}
.header-right{
  width: 200px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header-right i {
  font-size: 20px;
}
.iconfont{
  font-size: 20px;
  cursor: pointer;
}
.fold-btn-open{
  font-size: 20px;
  padding: 10px;
  margin-left: 10px;
}
.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 200px;
  min-height: 400px;
}
</style>